﻿<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>
<%@ page import="system.base.MonthStorageSearchEvent"%>
<%
WarehouseProductViewSearchEvent event1 = (WarehouseProductViewSearchEvent)context.getSessionValue("WarehouseProductViewSearchEvent");

ObjectList warehouseList = (ObjectList)context.getSessionValue("WarehouseListDetail");

String uiListDataTR_My1 = "<tr align='center' height=\"24\"  bgcolor=\"#FFFF37\"   onmouseover='this.style.backgroundColor=\"#D0DBE6\"' onmouseout='this.style.backgroundColor=\"#FFFF37\"'";
String uiListDataTR_My2 = "<tr align='center' height=\"24\"  bgcolor=\"#FFA042\"   onmouseover='this.style.backgroundColor=\"#D0DBE6\"' onmouseout='this.style.backgroundColor=\"#FFA042\"'";     
String uiListDataTR_My3 = "<tr align='center' height=\"24\"  bgcolor=\"#FF5809\"   onmouseover='this.style.backgroundColor=\"#D0DBE6\"' onmouseout='this.style.backgroundColor=\"#FF5809\"'";
String uiListDataTR_My4 = "<tr align='center' height=\"24\"  bgcolor=\"#800080\"   onmouseover='this.style.backgroundColor=\"#D0DBE6\"' onmouseout='this.style.backgroundColor=\"#800080\"'";
String []uiListDataTR_My = new String[]{uiListDataTR_My1, uiListDataTR_My2, uiListDataTR_My3,uiListDataTR_My4}; 

MonthStorageSearchEvent event = (MonthStorageSearchEvent)context.getSessionValue("MonthStorageSearchEvent");
LoginContext context1=(LoginContext)session.getAttribute("LoginContext");
String mp=null;
if(context1!=null){
	mp=	context1.getUser().getMobilePhone();

}
%>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="<%=Config.getWebPath()%>/css/ext-all.css" />
		<script type="text/javascript"	src="<%=Config.getWebPath()%>/js/ext/ext-base.js"></script>
	    <script type="text/javascript" src="<%=Config.getWebPath()%>/js/ext/ext-all.js"></script>			
	</head>
	
<!--********************* Part2:Java Code *********************-->

<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->

<script language=javascript>

<%
String msg = (String)session.getAttribute("MSG");
session.removeAttribute("MSG");
	
if(msg != null){
%>
    alert("<%=msg%>");
<%
}
%>

var list_code = "listReportProductMS2";


function process(val)
{var warehouseCode = $.jstree._reference("#warehouseLevel").get_checked();
var warehouseList = new Array();
var i = 0;
$.each(warehouseCode, function() {
          warehouseList[i] =($(this).attr("id"));
          i++;
});

SetValue("WarehouseCode",warehouseList); 
    SetValue("title","1");
    SetValue("providerName",GetValue("i_ProviderName"));

    SetValue("needAll",GetValue("i_needAll"));
    //仓库判断
    <% 	if(mp==null||mp.equals("1")==false){%>
    if(i==0){
        alert("请指定一个仓库");
        return false;
    }
    <%	}%>

    if(val == '1'){
        SetValue("begindate",GetValue("i_Year"));
        SetValue("enddate",GetValue("i_Month"));
        SetValue("querytype","1");
    }else{
        if(GetValue("i_StartLastUpdate") == ""){
            alert("起始日期不可为空!");
            return false;
        }
        SetValue("begindate",GetValue("i_StartLastUpdate"));
        SetValue("enddate",GetValue("i_EndLastUpdate"));
        SetValue("querytype","2");

    }
    SetValue("positionCode",GetValue("i_PositionCode"));
    SetValue("balanceMode",GetValue("i_BalanceMode"));
    var loadMask= new Ext.LoadMask(document.body,{
		msg : '正在处理, 请稍等...',
		removeMask : true
	});
	loadMask.show();
    frm.action = "<%=response.encodeURL(Config.getWebPath() + "/servlet/ReportServletMS2") %>";
    frm.submit();
    window.onblur = function() {
    	loadMask.hide();
    	window.onblur = null;
    };
}
//供应商选择后处理
function onSelectProvider(obj)
{
    SetValue("providerName", obj.Name);
    document.all.i_ProviderName.value = obj.Name;
}
function search(){
    SetValue("warehouseCode",GetValue("i_WarehouseCode"));
    SetAction(list_code);
    frm.target = "_self";
    frm.submit();
}
key_InitDefault();
key_RegSubmitHandler(search);
</script>
<script type="text/javascript" src = "<%=Config.getWebPath()%>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src = "<%=Config.getWebPath()%>/js/jquery.jstree.js"></script>
<link type="text/css" rel="stylesheet" href="<%=Config.getWebPath()%>/css/themes/default/style.css"/>
<script type="text/javascript">
	   $(function() {
		    $("#warehouseLevel").jstree({
		        "plugins" : [ "themes", "html_data", "checkbox", "ui" ]
		       
		    });
		    
		    var checkedWarehouseCodes = "<%=event1.getWarehouseTreeCodes()[0]%>";
		    
		    if(checkedWarehouseCodes == "") checkedWarehouseCodes = "00";
		    
		    var arrayCheckedWarehouseCodes = checkedWarehouseCodes.split(",");
		   
		   		  	
		  	var checkSel = function(ary, val) {
		  		for(var i=0; i<ary.length; i++) {
		  			if(ary[i] == val) {
		  				return true;
		  			}
		  		}
		  		
		  		return false;
		  	}
	

		  
		  
		});
			
</script>

<%=uiBody%>>

<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="providerName" value="">
<input type=hidden name="warehouseCode" value="<%=event1.getWarehouseTreeCodes()[0]%>" > 
<input type='hidden' name='begindate' value="">
<input type='hidden' name='enddate' value="">
<input type='hidden' name='querytype' value="">
<input type='hidden' name='title' value="">
<input type='hidden' name='needAll' value="">
<input type=hidden name='positionCode' value="<%=event.getPositionCode()%>"> <!--选择的货位code-->
<input type=hidden name='balanceMode' value="<%=event.getBalanceMode()%>"> <!--结算模式-->

<!--查询条件保留区域-->


<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
    int key_tab = 1 ;
%>

<table id=listTable cellpadding='1' cellspacing='1' width='100%' class='data_line'><thead class='data_th'>

<tr align='center' height='24'>

    <td colspan = "2">产品进、销、存报表</td>
</tr>

    
<tbody class='data_tb'>
    <tr height="24"  bgcolor="#EBEEF3">
        <td colspan = "2">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;仓库选择：
               选择仓库：    
            <div id="warehouseLevel" style="background-color: DEE4E9">
				<%=Warehouse.getWarehouseTree(warehouseList,event1.getWarehouseCodes())%>
			</div>
        &nbsp;&nbsp;供应商：<input type="text" class="texts" name="i_ProviderName" size="20" value="" key_tab="<%=key_tab++%>"/>
        <input type=button class=buttons value="选择" onclick="bizSelectProvider(false);return false" />
         所有相关纪录:
        <input type="checkbox" value="yes" name="i_needAll" checked="checked"  />
        </td>
    </tr>
 <tr height="24"  bgcolor="#EBEEF3">
   <td colspan = "2">
      &nbsp;&nbsp;&nbsp;&nbsp;仓库货位：
       <%=SelectManager.viewPosition(con,loginInfo.getLoginWarehouseCode(),"i_PositionCode","",false,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++),new String[]{loginInfo.getLoginWarehouseCode()})%>
         
        &nbsp;&nbsp;&nbsp;&nbsp;结算模式：
        <%=SelectManager.viewYKorMD("i_BalanceMode",event.getBalanceMode(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
  </td>
 </tr>
    <tr height="24"  bgcolor="#FFFFFF">
        <td >&nbsp;选择结算月份：<%=SelectManager.viewYearSelect(con,"i_Year","2012",false,"","-请选择-","","")%>  <%=SelectManager.viewMonthSelect(con,"i_Month","01",false,"","-请选择-","","")%></td>
        <td >
            <input type="button" name="button1" class='buttons' value="生成报表" onclick='process(1)'>
        </td>
    </tr>
    <tr height="24"  bgcolor="#EBEEF3">
        <td >&nbsp;&nbsp;&nbsp;选择时间段：<%=framework.custom.UIManager.generateDateInput("i_StartLastUpdate", "")%> 至 <%=framework.custom.UIManager.generateDateInput("i_EndLastUpdate", "")%></td>
        <td >
            <input type="button" name="button2" class='buttons' value="生成报表" onclick='process(2)'>
        </td>
    </tr>
</tbody>

</table>


<%=uiSearchEnd%>

</form>


<%@ include file="/framework/foot.jsp"%>
